<template>
	<view class="reply-container">
		<view class="result">
			<text class="result-text"><text style="color: red;">*</text>工单延期</text>
			<uni-data-checkbox  v-model="isPass" :localdata="status"></uni-data-checkbox>
		</view>
		<view style="padding: 10rpx 20rpx;">
			<!-- <view class="title"><text style="color: red;">*</text>审核描述</view> -->
			<textarea class="content" v-model="params.reason" placeholder="请输入审批描述..." name="" id="" cols="30" rows="10"></textarea>
		</view>
		<!-- <view class="title" style="margin-left: 20rpx;">审核附件</view>
		<view style="margin-left: 8rpx;">
			<upload @input='onchange'></upload>
		</view>
		<view class="title" style="margin-left: 20rpx;">网格长签字</view>
		<view class="sign-item" @click="goSignPage">
			<image :src="resultUrl" mode=""></image>
		</view> -->
		<!-- <view class="sign-img">
			<view class="left-text">业主签字:</view>
			<view class="sign-item" @click="goSignPage">
				<image :src="resultUrl" mode=""></image>
			</view>
		</view> -->
		<button class="btn" @click="submit">提交</button>
	</view>
</template>

<script>
	import upload from '@/components/upload.vue'
	export default {
		data() {
			return {
				isPass: null,
				params: {
					id: null,
					reason: '',
				},
				status: [{
						text: '同意',
						value: true
					},
					{
						text: '不同意',
						value: false
					}
				]
			}
		},
		components: {
			upload
		},
		onShow() {
		},
		onLoad(options) {
			this.params.id = +options.id
		},
		methods: {
			submit() {
				if(this.isPass == null){
					uni.showToast({
						title: '请填写审批结果',
						icon: 'none'
					})
				}else if(this.params.reason.trim() === '') {
					uni.showToast({
						title: '请填写审批描述',
						icon: 'none'
					})
				}else {
					// console.log(this.params)
					this.handleDelay()
					// this.completeRectify()
				}
			},
			handleDelay() {
				// this.params.id = parseInt(this.ticketId)
				// this.params.操作类型 = 'complete'
				uni.showLoading({
					mask: true
				})
				let path = this.isPass ? 'ticketSystem/delay/agree' : 'ticketSystem/delay/disagree'
				this.$http2.post(path, this.params).then(res => {
					console.log(res)
					if (res.code === 10000) {
						uni.redirectTo({
							url: '../acceptSuccess/acceptSuccess?path=../delayApply/delayApply' + '&title=返回审批列表'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.reply-container {
		padding-top: 20rpx;
		.result {
			padding: 10rpx;
			display: flex;
			font-size: 32rpx;
			align-items: center;
			.result-text {
				margin-right: 40rpx;
			}
		}
		// padding: 20rpx;
		.title {
			margin-bottom: 20rpx;
		}
		.content {
			height: 400rpx;
			width: 710rpx;
			padding: 20rpx;
			border: 2rpx solid #ccc;
			margin-bottom: 10rpx;
		}
		.btn {
			width: 568rpx;
			height: 80rpx;
			line-height: 80rpx;
			margin-top: 160rpx;
			background-color: #1152FC;
			color: #fff;
		}
		.sign-item {
			margin-left: 20rpx;
			width: 220rpx;
			height: 220rpx;
			image {
				width: 100%;
				height: 100%;
			}
		}
	}
</style>